﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace Nirvana
{
    [CustomEditor(typeof(SceneGridView))]
    public class SceneGridViewEditor : SceneGridEditor
    {
        public enum ModeType
        {
            /// <summary>
            /// walkable edit mode
            /// </summary>
            GroundMode,
        }

        private static readonly GUIContent[] ModeItems = new GUIContent[]
        {
            new GUIContent("Ground","Switch into ground edit mode."),
        };

        private ModeType modetype = ModeType.GroundMode;
        private SceneGridGroundMode groundMode;
        protected override ISceneGridMode EditMode
        {
            get
            {
                switch (this.modetype)
                {
                    case ModeType.GroundMode:
                        if(this.groundMode == null)
                            this.groundMode = new SceneGridGroundMode();
                        return this.groundMode;
                    default:
                        return null;
                }
            }
        }

        protected override bool DrawEditMode()
        {
            var _modetype = (ModeType)GUILayout.Toolbar((int)this.modetype, ModeItems);
            if(_modetype != this.modetype)
            {
                this.modetype = _modetype;
                return true;
            }
            return false;
        }
    }
}

